package com.event.management.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.event.management.backend.domain.EventQuestionnaire;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 活动问卷关联Mapper接口
 */
@Mapper
public interface EventQuestionnaireMapper extends BaseMapper<EventQuestionnaire> {
    
    /**
     * 检查活动和问卷的关联是否存在
     * @param eventId 活动ID
     * @param templateId 问卷模板ID
     * @return 存在返回1，不存在返回0
     */
    @Select("SELECT COUNT(1) FROM event_questionnaire WHERE event_id = #{eventId} AND template_id = #{templateId}")
    int checkRelationExists(@Param("eventId") Long eventId, @Param("templateId") Long templateId);
} 